package com.qkl.xiatang.app.service.impl;

import com.qkl.xiatang.app.mapper.PondStatusMapper;
import com.qkl.xiatang.app.utils.appenum.PondStatusEnum;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class PondStatusService {

    @Autowired
    private PondStatusMapper pondStatusMapper;

    /**
     *
     * @param pondIdList
     * @param userName
     */
    public void pondStatusIdle(List<String> pondIdList, String userName){
        this.updatePondStatus(pondIdList, PondStatusEnum.IDLE.getStatus(),userName);
    }



    private void updatePondStatus(String pondId, Integer status, String userName){
        List<String> pondIdList = new ArrayList<>();
        pondIdList.add(pondId);
        this.updatePondStatus(pondIdList,status,userName);
    }
    private void updatePondStatus(List<String> pondIdList, Integer status, String userName){
        if(ObjectUtils.isEmpty(pondIdList) || null == status){
            return;
        }
        pondStatusMapper.updatePondStatus(pondIdList,status,userName);
    }

}
